import React from 'react'
import {Card, Button, message} from 'antd'
import './ui.less'

export default class Buttons extends React.Component {

  showMessage = (type, time) => {
    message[type](`恭喜你,这个是${type}`, time, function () {
    }).then((res) => message.success(`回调成功${res}`, 2.5))
    // message.config({
    //     top: 10,      //消息距离顶部的位置
    //     duration: 3,  //默认自动关闭延时，单位秒
    //     maxCount: 4,  //最大显示数, 超过限制时，最早的消息会被自动关闭
    // });

  }


  render() {
    return (
      <div>
        <Card title="全局提示框" className="card-wrap" style={{marginTop: 10}}>
          <Button type="primary" onClick={() => this.showMessage('success', 10)}>Success</Button>
          <Button type="primary" onClick={() => this.showMessage('info')}>Info</Button>
          <Button type="dashed" onClick={() => this.showMessage('warning')}>Warning</Button>
          <Button type="default" onClick={() => this.showMessage('error')}>Error</Button>
          <Button type="primary" onClick={() => this.showMessage('loading')}>Loading</Button>
        </Card>
      </div>
    );
  }
}
